/* @(#)GSLoginAction.java    
*
* Project: BUS
*
* Modify Information:
* =============================================================================
*   Author       Date       Description
*   ------------ ---------- ---------------------------------------------------
*   Simonyi Peng 2006-2-7    建立
*
* Copyright Notice:
* =============================================================================
*    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
*        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
*        Haidian District, Beijing ,100081, China All rights reserved.
*
*    This software is the confidential and proprietary information of
*        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
*        You shall not disclose such Confidential Information and shall use it
*        only in accordance with the terms of the license agreement you entered
*        into with HiTRUST.
*
* Warning:
* =============================================================================
* 
*/
package com.hitrust.gs.action;

import java.util.ArrayList;
import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.business.GSOrgProcessor;
import com.hitrust.gs.business.GSOrderProcesser;
import com.hitrust.gs.business.GSOrderProcessor;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.service.GSBaseManager;
import com.hitrust.gs.util.exception.*;
import com.hitrust.gs.util.lang.StringUtils;
import com.hitrust.gs.util.page.ResultProcess;
import com.hitrust.gs.vo.GSOrderSubmitVO;
import com.hitrust.gs.vo.GSOrderVO;


public class GSOrderReviewDetailBackQueryAction extends GSBaseAction {
	public String execute(GSBaseForm aForm) throws GSException {
	    
	    GSOperatorBean operatorBean = (GSOperatorBean)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
        
        GSOrgProcessor processer = new GSOrgProcessor ();
        GSOrderProcessor orderProc = new GSOrderProcessor ();
        GSOrderProcesser ordProcesser = new GSOrderProcesser();

        //目的：从订单明细页面返回到查询结果页面
        try{
		    ArrayList ary = processer.getOperOrgAndSubOrg(operatorBean.getGs_oper_org_id());
		    aForm.getRequest().setAttribute("orglist",ary);
		    
		    String[] buffer = (String[])aForm.getSession().getAttribute("auditQueryCondition");
	        String orderId = buffer[0];
	        String orderCategory = buffer[1];
	        String workCorpId = buffer[2];
		    
		    		
		    //先查询出当前初审人员有权审核的所有订单
		    ArrayList orderIdAry = null;//ordProcesser.getAllReviewNeedOrder(operatorBean.getGs_oper_id(),operatorBean.getGs_oper_org_id(),orderId,orderCategory,workCorpId);
		    
		    //为这些订单构造view内容
		    ArrayList tList = new ArrayList();
		    for(int i=0;i<orderIdAry.size();i++){
		        GSOrderVO tGSOrderVO = new GSOrderVO();
		        tGSOrderVO.orderid = (String)orderIdAry.get(i);
		        ArrayList tempList = orderProc.getOrderAndManufacture(tGSOrderVO);
		        for(int j=0;j<tempList.size();j++){
		            tList.add(tempList.get(j));
		        }
		    }
		    		    
            ResultProcess tRsProc = new ResultProcess();
            tRsProc.setResult(tList);
            aForm.getRequest().setAttribute("orderlist",tRsProc);
            
            //暂时用此方法传递分页参数
            aForm.getRequest().setAttribute("choice",aForm.getRequest().getParameter("choice"));
		                
            
        }catch(GSException e){
            aForm.getRequest().setAttribute("action", "A100201.do");
            throw e;
        }
        
        return GSBaseConstants.FORWARD_SUCCESS;
        
	}
}
